package org.itworks.biodev.model;

public class ProductOrder {
	private float price;
	private Integer quantity;
	private Product product;
	private int productId;
	private int orderId;
	private Order order;
	
	public float getPrice() {
		return price;
	}
	public void setPrice(float price) {
		this.price = price;
	}
	public Integer getQuantity() {
		return quantity;
	}
	public void setQuantity(Integer quantity) {
		this.quantity = quantity;
	}
	public Order getOrder() throws Exception {
		if(order == null) {
			order = OrderTable.getInstance().findOrderFromProductOrder(this);
		}
		return order;
	}
	public void setOrder(Order order) {
		this.order = order;
		this.orderId = order.getId();
	}
	public Product getProduct() throws Exception {
		if(product == null) {
			product = ProductOrderTable.getInstance().findProductFromProductOrder(this);
		}
		return product;
	}
	public void setProduct(Product xProduct) {
		this.product = xProduct;
		this.productId = product.getId();
	}
	public int getProductId() {
		return productId;
	}
	public void setProductId(int productId) {
		this.productId = productId;
	}
	public int getOrderId() {
		return orderId;
	}
	public void setOrderId(int orderId) {
		this.orderId = orderId;
	}
}
